package com.adam.service;

import com.adam.dao.BookMapper;
import com.adam.pojo.Books;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;

import java.awt.print.Book;
import java.util.List;

//@Service
public class BookServiceImpl implements BookService {

    //service调用Dao层
    //设置一个set方法，方便spring管理
    private BookMapper bookMapper;

//    @Autowired
    public void setBookMapper(BookMapper bookMapper) {
        this.bookMapper = bookMapper;
    }

    public int addBook(Books book) {
        return bookMapper.addBook(book);
    }

    public int deleteBook(int id) {
        return bookMapper.deleteBook(id);
    }

    public int updateBook(Books book) {
        return bookMapper.updateBook(book);
    }

    public Books queryByID(int id) {
        return bookMapper.queryByID(id);
    }

    public List<Books> queryAll() {
        return bookMapper.queryAll();
    }

    public List<Books> searchBook(String bookName){
        return bookMapper.searchBook(bookName);
    }
}
